package imagekeeper.data;

import java.sql.Connection;
import java.sql.SQLException;
import imagekeeper.dmi.ImageTag;
import imagekeeper.data.mapping.ImageTagMapper;


class SqlStatementCreateImageTag extends SqlStatement {
    private final static String ParamTagValue = "tagValue";
    private final static String ParamImageId = "imageId";
    
    public SqlStatementCreateImageTag(Connection con) throws SQLException {
        statement = con.prepareCall("{call " + ImageTagMapper.SpCreateUpdateImageTag + "(?, ?)}");
    }
    
    public SqlStatementCreateImageTag(Connection con, ImageTag tag, int imageId) throws SQLException {
        statement = con.prepareCall("{call " + ImageTagMapper.SpCreateUpdateImageTag + "(?, ?)}");
        statement.setString(ParamTagValue, tag.getValue());
        statement.setInt(ParamImageId, imageId);
    }
    
    public void setTagValue(String value) throws SQLException {
        statement.setString(ParamTagValue, value);
    }
    
    public void setImageId(int id) throws SQLException {
        statement.setInt(ParamImageId, id);
    }
}
